// const url =
//   "https://fanyi.baidu.com/gettts?lan=en&spd=3&source=web&text=HelloWorld";
// // const url = "https://fanyi.baidu.com/gettts?lan=uk&spd=3&source=web&text=HelloWorld";

// fetch(url).then(res => res.blob()).then(data => console.log(data));
fetch("https://fanyi.baidu.com/gettts?lan=en&text=hello&spd=3&source=web", {
  headers: {
    accept: "*/*",
    "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
    range: "bytes=0-",
    "sec-ch-ua":
      '"Chromium";v="124", "Microsoft Edge";v="124", "Not-A.Brand";v="99"',
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": '"Windows"',
    "sec-fetch-dest": "audio",
    "sec-fetch-mode": "no-cors",
    "sec-fetch-site": "same-origin",
    cookie:
      'BAIDU_WISE_UID=wapp_1706887608146_218; APPGUIDE_10_6_9=1; REALTIME_TRANS_SWITCH=1; FANYI_WORD_SWITCH=1; HISTORY_SWITCH=1; SOUND_SPD_SWITCH=1; SOUND_PREFER_SWITCH=1; __bid_n=18db718c6599104560a455; BIDUPSID=9846F765B42392F5E24F19E208A1F3EB; PSTM=1708704729; MCITY=-289%3A; APPGUIDE_10_7_0=1; APPGUIDE_10_7_1=1; BAIDUID=121598CE8B2CFF1667A04A3DB131DE1C:FG=1; BAIDUID_BFESS=121598CE8B2CFF1667A04A3DB131DE1C:FG=1; APPGUIDE_10_7_2=1; smallFlowVersion=old; ZFY=HaBkjE:B14Yj24CdlIQODhf0b0rYw:BLZ0o:BVUoW4WIiI:C; H_PS_PSSID=40366_40378_40415_40305_40511_40445_60042_60024_60031_40080_60142; arialoadData=false; BDUSS=duM0FSU344N2hMZnhvd0JRMVJpMGpmcEpqbTBOQ3oxNS02SUJ3UEhxLXQ1RmxtRVFBQUFBJCQAAAAAAAAAAAEAAABk2TztusO1xNz418-2vMO7wcsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK1XMmatVzJmaz; BDUSS_BFESS=duM0FSU344N2hMZnhvd0JRMVJpMGpmcEpqbTBOQ3oxNS02SUJ3UEhxLXQ1RmxtRVFBQUFBJCQAAAAAAAAAAAEAAABk2TztusO1xNz418-2vMO7wcsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK1XMmatVzJmaz; Hm_lvt_64ecd82404c51e03dc91cb9e8c025574=1713930401,1713934795,1714562537,1714625802; ZD_ENTRY=bing; RT="z=1&dm=baidu.com&si=08109d4e-dddc-4193-92ea-15eafac91388&ss=lvotd4mn&sl=3&tt=2u2&bcn=https%3A%2F%2Ffclog.baidu.com%2Flog%2Fweirwood%3Ftype%3Dperf&ld=3xg1"; Hm_lpvt_64ecd82404c51e03dc91cb9e8c025574=1714643512; ab_sr=1.0.1_MWNkMTQ2NmFlMmNhYWFjNzBhM2VmYWFkN2I2YTk3MTNjNTMxMzI2Y2JjOWZiNzA0OWEyZDk2NTIwYTMwMmMyMWE3NjA1MjA2ZDk4YzUyYjkyYzA2ODZiZjY2NDllZmFlYTYwYTA0NWY3YzZkYmRjNGEwZDNmN2ZlYzZkOGFhMGM0NWZlNGI4MjhlNTZjMGQ2Zjk3MmY3OThmNjBiMGFlNmE0MjM3MGU2ZTFlZDg0ZjMyMDkxNjY3ZGU0ZTBmNDgx',
    Referer: "https://fanyi.baidu.com/",
    "Referrer-Policy": "strict-origin-when-cross-origin"
  },
  body: null,
  method: "GET"
})
  .then(res => res.blob())
  .then(data => {
    const reader = new FileReader();
    reader.readAsDataURL(data);
    reader.onload = () => {
      console.log(reader.result);
    };
  });
